import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
import { useRouter } from 'vue-router'
export const useLayoutStore = defineStore('layout', () => {
    const refreshKey = ref(0)
    const isCollapse = ref(false)
    const createGamePopVisible = ref(false)
    // const activeTag
    const activeRouterArray = ref([{name:'主页',fullPath:'main'}])
    const pushActiveRouter = (name:string,fullPath:string)=>{
        const had = activeRouterArray.value.findIndex(v=>v.name === name) >= 0;
        if(!had){
            activeRouterArray.value.push({name,fullPath});
        }

    }
    const removeRouterArray = (index:number)=>{
        activeRouterArray.value.splice(index, 1)
    }
    return { refreshKey,isCollapse, activeRouterArray, createGamePopVisible, pushActiveRouter, removeRouterArray };
});